Repository navigation
feat(pfunctor): fold rules and bounds for chargeUnder - #530
Merged
Merged
Conversation
Fold rules for wpFold under chargeUnder and demonicUnder at a general postcondition, bounds for ite and dite, the price-vector forms, and the restriction equation wpFold_chargeUnder_eq_restrict for a general postcondition.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The call and bind rules take any postcondition on the continuation, and the results of a bind live in independent universes. Boundary tests cover calls with no allowed answer, exact budgets, the leaf invariant of a bind, and a priced fold strictly below the priced vector fold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Thanks for this. I pushed a few changes to the branch and merged main. Each statement change is a strict generalization, and names and explicit arguments are unchanged.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Free/WP/Charge.leanhas the cost transformerchargeUnderand its rules at the postcondition0. A costanalysis that composes programs needs the rules at a general postcondition, and bounds for the control
constructs. This PR adds 18 lemmas to
Free/WP/Charge.lean, under the existing imports:OpSpec.chargeUnder_eq,OpSpec.demonicUnder_eq.wpFold_chargeUnder_liftBind_le_iff,wpFold_chargeUnder_liftBind_const,wpFold_chargeUnder_liftBind_const_add,wpFold_chargeUnder_liftBind_le,wpFold_chargeUnder_pure_le,wpFold_chargeUnder_bind_le_add,wpFold_demonicUnder_liftBind_const.wpFold_ite_le_max_enat,wpFold_dite_le_max_enat.isRollBound_iff_wpFold_chargeUnder_true,wpFold_charge_eq_chargeUnder_true, andwpFold_chargeUnder_eq_restrict, which generalisescostUnder_eq_cost_restrictfrom the postcondition0to any postcondition.wpFold_chargeUnder_pi_apply,wpFold_chargeUnder_pi_le_iff,wpFold_chargeUnder_price_le_sum,wpFold_chargeUnder_price_le.wpFold_chargeUnder_bind_le_addis proved fromcostUnder_bind_le_of_wpFold. The lemmas are used by atactic downstream that derives time bounds of free programs and refers to them by these names.